package com.hgw.Demo03_InterpreterPattern.examples;

/**
 * Data time:2021/12/17 19:28
 * StudentID:2019112118
 * Author:hgw
 * Description: And结点类，充当非终结符表达式角色
 */
public class AndNode extends AbstractNode{
    private AbstractNode left;  // And的左表达式
    private AbstractNode right; // And的右表达式

    public AndNode(AbstractNode left, AbstractNode right) {
        this.left = left;
        this.right = right;
    }

    // And表达式解释操作
    @Override
    public String interpret() {
        return left.interpret() + "再" + right.interpret();
    }
}
